home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part1 / 7321 < prev    next >
Encoding:
Text File  |  1996-08-05  |  1.5 KB  |  54 lines

  1. Path: newshost.lanl.gov!tanmoy
  2. From: tanmoy@qcd.lanl.gov (Tanmoy Bhattacharya)
  3. Newsgroups: comp.lang.c
  4. Subject: Re: Link list Vs Memory block
  5. Date: 16 Feb 1996 15:57:38 GMT
  6. Organization: Los Alamos National Laboratory
  7. Message-ID: <TANMOY.96Feb16085738@qcd.lanl.gov>
  8. References: <4g0r86$fk5@netnews.upenn.edu>
  9. NNTP-Posting-Host: qcd.lanl.gov
  10. Mime-Version: 1.0
  11. Content-Type: text
  12. In-reply-to: skramiah@gradine.cis.upenn.edu's message of 16 Feb 1996 02:47:34 GMT
  13.  
  14. In article <4g0r86$fk5@netnews.upenn.edu>
  15. skramiah@gradine.cis.upenn.edu (Senthil K. Ramiah) writes: 
  16. <snip>
  17.    struct struct_s
  18.    {
  19.        int i;
  20.        char c;
  21.    };
  22.    main()
  23.    {
  24.        struct struct_s *s1;
  25.  
  26.        s1 = malloc(sizeof(struct struct_s) * 2);
  27.  
  28.        s1->i =1; s1->c ='a';
  29.        s1++;
  30.        s1->i =2; s1->c = 'b';
  31.    }
  32.  
  33.    My questions are:
  34.  
  35.    1) How safe is it to use the above method
  36.       instead of a link list.
  37.  
  38. An array is as safe as a linked list. They serve different purposes
  39. though. 
  40.  
  41.    2) Will this implementation work on all platforms.
  42.  
  43. Why not?
  44.  
  45. Cheers
  46. Tanmoy
  47. --
  48. tanmoy@qcd.lanl.gov(128.165.23.46) DECNET: BETA::"tanmoy@lanl.gov"(1.218=1242)
  49. Tanmoy Bhattacharya O:T-8(MS B285)LANL,NM87545 H:#9,3000,Trinity Drive,NM87544
  50. Others see <gopher://yaleinfo.yale.edu:7700/00/Internet-People/internet-mail>,
  51. <http://alpha.acast.nova.edu/cgi-bin/inmgq.pl>or<ftp://csd4.csd.uwm.edu/pub/
  52. internetwork-mail-guide>. -- <http://nqcd.lanl.gov/people/tanmoy/tanmoy.html>
  53. fax: 1 (505) 665 3003   voice: 1 (505) 665 4733    [ Home: 1 (505) 662 5596 ]
  54.